{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using TensorFlow backend.\n",
      "/home/leon/miniconda3/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6\n",
      "  return f(*args, **kwds)\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "from keras.models import Model\n",
    "from keras.layers import Input, Dense, RepeatVector\n",
    "from keras.layers.merge import Add, Subtract, Multiply, Average, Maximum, Minimum, Concatenate, Dot\n",
    "from keras import backend as K\n",
    "import json\n",
    "from collections import OrderedDict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "def format_decimal(arr, places=6):\n",
    "    return [round(x * 10**places) / 10**places for x in arr]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "DATA = OrderedDict()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[merge.Concatenate.0] 1D inputs, axis=-1**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "in: [0, 0.2, 0.5, -0.1, 1, 2]\n",
      "in shape: (6,)\n",
      "out shape: (4,)\n",
      "out: [7.3, -0.21, -2.45, 4.48]\n"
     ]
    }
   ],
   "source": [
    "layer_0 = Input(shape=(6,))\n",
    "layer_1a = Dense(2, activation='linear')(layer_0)\n",
    "layer_1b = Dense(2, activation='linear')(layer_0)\n",
    "layer_2 = Concatenate(axis=-1)([layer_1a, layer_1b])\n",
    "model = Model(inputs=layer_0, outputs=layer_2)\n",
    "\n",
    "W_1a = np.array([0.1, 0.4, 0.5, 0.1, 1, -2, 0, 0.3, 0.2, 0.1, 3, 0]).reshape((6, 2))\n",
    "b_1a = np.array([0.5, 0.7])\n",
    "W_1b = np.array([1, 0, -0.9, 0.6, -0.7, 0, 0.2, 0.4, 0, 0, -1, 2.3]).reshape((6, 2))\n",
    "b_1b = np.array([0.1, -0.2])\n",
    "model.set_weights([W_1a, b_1a, W_1b, b_1b])\n",
    "\n",
    "data_in = [0, 0.2, 0.5, -0.1, 1, 2]\n",
    "data_in_shape = (6,)\n",
    "print('in:', data_in)\n",
    "print('in shape:', data_in_shape)\n",
    "arr_in = np.array(data_in, dtype='float32').reshape(data_in_shape)\n",
    "result = model.predict(np.array([arr_in]))\n",
    "arr_out = result[0]\n",
    "data_out_shape = arr_out.shape\n",
    "print('out shape:', data_out_shape)\n",
    "data_out = format_decimal(arr_out.ravel().tolist())\n",
    "print('out:', data_out)\n",
    "\n",
    "DATA['merge.Concatenate.0'] = {\n",
    "    'input': {'data': data_in, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in [W_1a, b_1a, W_1b, b_1b]],\n",
    "    'expected': {'data': data_out, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[merge.Concatenate.1] 2D inputs, axis=-1**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "in: [0, 0.2, 0.5, -0.1, 1, 2]\n",
      "in shape: (6,)\n",
      "out shape: (3, 4)\n",
      "out: [7.3, -0.21, -2.45, 4.48, 7.3, -0.21, -2.45, 4.48, 7.3, -0.21, -2.45, 4.48]\n"
     ]
    }
   ],
   "source": [
    "layer_0 = Input(shape=(6,))\n",
    "layer_1a = Dense(2, activation='linear')(layer_0)\n",
    "layer_1a = RepeatVector(3)(layer_1a)\n",
    "layer_1b = Dense(2, activation='linear')(layer_0)\n",
    "layer_1b = RepeatVector(3)(layer_1b)\n",
    "layer_2 = Concatenate(axis=-1)([layer_1a, layer_1b])\n",
    "model = Model(inputs=layer_0, outputs=layer_2)\n",
    "\n",
    "W_1a = np.array([0.1, 0.4, 0.5, 0.1, 1, -2, 0, 0.3, 0.2, 0.1, 3, 0]).reshape((6, 2))\n",
    "b_1a = np.array([0.5, 0.7])\n",
    "W_1b = np.array([1, 0, -0.9, 0.6, -0.7, 0, 0.2, 0.4, 0, 0, -1, 2.3]).reshape((6, 2))\n",
    "b_1b = np.array([0.1, -0.2])\n",
    "model.set_weights([W_1a, b_1a, W_1b, b_1b])\n",
    "\n",
    "data_in = [0, 0.2, 0.5, -0.1, 1, 2]\n",
    "data_in_shape = (6,)\n",
    "print('in:', data_in)\n",
    "print('in shape:', data_in_shape)\n",
    "arr_in = np.array(data_in, dtype='float32').reshape(data_in_shape)\n",
    "result = model.predict(np.array([arr_in]))\n",
    "arr_out = result[0]\n",
    "data_out_shape = arr_out.shape\n",
    "print('out shape:', data_out_shape)\n",
    "data_out = format_decimal(arr_out.ravel().tolist())\n",
    "print('out:', data_out)\n",
    "\n",
    "DATA['merge.Concatenate.1'] = {\n",
    "    'input': {'data': data_in, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in [W_1a, b_1a, W_1b, b_1b]],\n",
    "    'expected': {'data': data_out, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[merge.Concatenate.2] 2D inputs, axis=-2**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "in: [0, 0.2, 0.5, -0.1, 1, 2]\n",
      "in shape: (6,)\n",
      "out shape: (6, 2)\n",
      "out: [7.3, -0.21, 7.3, -0.21, 7.3, -0.21, -2.45, 4.48, -2.45, 4.48, -2.45, 4.48]\n"
     ]
    }
   ],
   "source": [
    "layer_0 = Input(shape=(6,))\n",
    "layer_1a = Dense(2, activation='linear')(layer_0)\n",
    "layer_1a = RepeatVector(3)(layer_1a)\n",
    "layer_1b = Dense(2, activation='linear')(layer_0)\n",
    "layer_1b = RepeatVector(3)(layer_1b)\n",
    "layer_2 = Concatenate(axis=-2)([layer_1a, layer_1b])\n",
    "model = Model(inputs=layer_0, outputs=layer_2)\n",
    "\n",
    "W_1a = np.array([0.1, 0.4, 0.5, 0.1, 1, -2, 0, 0.3, 0.2, 0.1, 3, 0]).reshape((6, 2))\n",
    "b_1a = np.array([0.5, 0.7])\n",
    "W_1b = np.array([1, 0, -0.9, 0.6, -0.7, 0, 0.2, 0.4, 0, 0, -1, 2.3]).reshape((6, 2))\n",
    "b_1b = np.array([0.1, -0.2])\n",
    "model.set_weights([W_1a, b_1a, W_1b, b_1b])\n",
    "\n",
    "data_in = [0, 0.2, 0.5, -0.1, 1, 2]\n",
    "data_in_shape = (6,)\n",
    "print('in:', data_in)\n",
    "print('in shape:', data_in_shape)\n",
    "arr_in = np.array(data_in, dtype='float32').reshape(data_in_shape)\n",
    "result = model.predict(np.array([arr_in]))\n",
    "arr_out = result[0]\n",
    "data_out_shape = arr_out.shape\n",
    "print('out shape:', data_out_shape)\n",
    "data_out = format_decimal(arr_out.ravel().tolist())\n",
    "print('out:', data_out)\n",
    "\n",
    "DATA['merge.Concatenate.2'] = {\n",
    "    'input': {'data': data_in, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in [W_1a, b_1a, W_1b, b_1b]],\n",
    "    'expected': {'data': data_out, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[merge.Concatenate.3] 2D inputs, axis=1**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "in: [0, 0.2, 0.5, -0.1, 1, 2]\n",
      "in shape: (6,)\n",
      "out shape: (6, 2)\n",
      "out: [7.3, -0.21, 7.3, -0.21, 7.3, -0.21, -2.45, 4.48, -2.45, 4.48, -2.45, 4.48]\n"
     ]
    }
   ],
   "source": [
    "layer_0 = Input(shape=(6,))\n",
    "layer_1a = Dense(2, activation='linear')(layer_0)\n",
    "layer_1a = RepeatVector(3)(layer_1a)\n",
    "layer_1b = Dense(2, activation='linear')(layer_0)\n",
    "layer_1b = RepeatVector(3)(layer_1b)\n",
    "layer_2 = Concatenate(axis=1)([layer_1a, layer_1b])\n",
    "model = Model(inputs=layer_0, outputs=layer_2)\n",
    "\n",
    "W_1a = np.array([0.1, 0.4, 0.5, 0.1, 1, -2, 0, 0.3, 0.2, 0.1, 3, 0]).reshape((6, 2))\n",
    "b_1a = np.array([0.5, 0.7])\n",
    "W_1b = np.array([1, 0, -0.9, 0.6, -0.7, 0, 0.2, 0.4, 0, 0, -1, 2.3]).reshape((6, 2))\n",
    "b_1b = np.array([0.1, -0.2])\n",
    "model.set_weights([W_1a, b_1a, W_1b, b_1b])\n",
    "\n",
    "data_in = [0, 0.2, 0.5, -0.1, 1, 2]\n",
    "data_in_shape = (6,)\n",
    "print('in:', data_in)\n",
    "print('in shape:', data_in_shape)\n",
    "arr_in = np.array(data_in, dtype='float32').reshape(data_in_shape)\n",
    "result = model.predict(np.array([arr_in]))\n",
    "arr_out = result[0]\n",
    "data_out_shape = arr_out.shape\n",
    "print('out shape:', data_out_shape)\n",
    "data_out = format_decimal(arr_out.ravel().tolist())\n",
    "print('out:', data_out)\n",
    "\n",
    "DATA['merge.Concatenate.3'] = {\n",
    "    'input': {'data': data_in, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in [W_1a, b_1a, W_1b, b_1b]],\n",
    "    'expected': {'data': data_out, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[merge.Concatenate.4] 2D inputs, axis=2**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "in: [0, 0.2, 0.5, -0.1, 1, 2]\n",
      "in shape: (6,)\n",
      "out shape: (3, 4)\n",
      "out: [7.3, -0.21, -2.45, 4.48, 7.3, -0.21, -2.45, 4.48, 7.3, -0.21, -2.45, 4.48]\n"
     ]
    }
   ],
   "source": [
    "layer_0 = Input(shape=(6,))\n",
    "layer_1a = Dense(2, activation='linear')(layer_0)\n",
    "layer_1a = RepeatVector(3)(layer_1a)\n",
    "layer_1b = Dense(2, activation='linear')(layer_0)\n",
    "layer_1b = RepeatVector(3)(layer_1b)\n",
    "layer_2 = Concatenate(axis=2)([layer_1a, layer_1b])\n",
    "model = Model(inputs=layer_0, outputs=layer_2)\n",
    "\n",
    "W_1a = np.array([0.1, 0.4, 0.5, 0.1, 1, -2, 0, 0.3, 0.2, 0.1, 3, 0]).reshape((6, 2))\n",
    "b_1a = np.array([0.5, 0.7])\n",
    "W_1b = np.array([1, 0, -0.9, 0.6, -0.7, 0, 0.2, 0.4, 0, 0, -1, 2.3]).reshape((6, 2))\n",
    "b_1b = np.array([0.1, -0.2])\n",
    "model.set_weights([W_1a, b_1a, W_1b, b_1b])\n",
    "\n",
    "data_in = [0, 0.2, 0.5, -0.1, 1, 2]\n",
    "data_in_shape = (6,)\n",
    "print('in:', data_in)\n",
    "print('in shape:', data_in_shape)\n",
    "arr_in = np.array(data_in, dtype='float32').reshape(data_in_shape)\n",
    "result = model.predict(np.array([arr_in]))\n",
    "arr_out = result[0]\n",
    "data_out_shape = arr_out.shape\n",
    "print('out shape:', data_out_shape)\n",
    "data_out = format_decimal(arr_out.ravel().tolist())\n",
    "print('out:', data_out)\n",
    "\n",
    "DATA['merge.Concatenate.4'] = {\n",
    "    'input': {'data': data_in, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in [W_1a, b_1a, W_1b, b_1b]],\n",
    "    'expected': {'data': data_out, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[merge.Concatenate.5] 3x 2D inputs, axis=-1**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "in: [0, 0.2, 0.5, -0.1, 1, 2]\n",
      "in shape: (6,)\n",
      "out shape: (3, 6)\n",
      "out: [7.3, -0.21, -2.45, 4.48, -2.45, 4.48, 7.3, -0.21, -2.45, 4.48, -2.45, 4.48, 7.3, -0.21, -2.45, 4.48, -2.45, 4.48]\n"
     ]
    }
   ],
   "source": [
    "layer_0 = Input(shape=(6,))\n",
    "layer_1a = Dense(2, activation='linear')(layer_0)\n",
    "layer_1a = RepeatVector(3)(layer_1a)\n",
    "layer_1b = Dense(2, activation='linear')(layer_0)\n",
    "layer_1b = RepeatVector(3)(layer_1b)\n",
    "layer_1c = Dense(2, activation='linear')(layer_0)\n",
    "layer_1c = RepeatVector(3)(layer_1c)\n",
    "layer_2 = Concatenate(axis=-1)([layer_1a, layer_1b, layer_1c])\n",
    "model = Model(inputs=layer_0, outputs=layer_2)\n",
    "\n",
    "W_1a = np.array([0.1, 0.4, 0.5, 0.1, 1, -2, 0, 0.3, 0.2, 0.1, 3, 0]).reshape((6, 2))\n",
    "b_1a = np.array([0.5, 0.7])\n",
    "W_1b = np.array([1, 0, -0.9, 0.6, -0.7, 0, 0.2, 0.4, 0, 0, -1, 2.3]).reshape((6, 2))\n",
    "b_1b = np.array([0.1, -0.2])\n",
    "W_1c = np.array([1, 0, -0.9, 0.6, -0.7, 0, 0.2, 0.4, 0, 0, -1, 2.3]).reshape((6, 2))\n",
    "b_1c = np.array([0.1, -0.2])\n",
    "model.set_weights([W_1a, b_1a, W_1b, b_1b, W_1c, b_1c])\n",
    "\n",
    "data_in = [0, 0.2, 0.5, -0.1, 1, 2]\n",
    "data_in_shape = (6,)\n",
    "print('in:', data_in)\n",
    "print('in shape:', data_in_shape)\n",
    "arr_in = np.array(data_in, dtype='float32').reshape(data_in_shape)\n",
    "result = model.predict(np.array([arr_in]))\n",
    "arr_out = result[0]\n",
    "data_out_shape = arr_out.shape\n",
    "print('out shape:', data_out_shape)\n",
    "data_out = format_decimal(arr_out.ravel().tolist())\n",
    "print('out:', data_out)\n",
    "\n",
    "DATA['merge.Concatenate.5'] = {\n",
    "    'input': {'data': data_in, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in [W_1a, b_1a, W_1b, b_1b, W_1c, b_1c]],\n",
    "    'expected': {'data': data_out, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[merge.Concatenate.6] 4x 2D inputs, axis=-1**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "in: [0, 0.2, 0.5, -0.1, 1, 2]\n",
      "in shape: (6,)\n",
      "out shape: (3, 8)\n",
      "out: [7.3, -0.21, -2.45, 4.48, -2.45, 4.48, -2.45, 4.48, 7.3, -0.21, -2.45, 4.48, -2.45, 4.48, -2.45, 4.48, 7.3, -0.21, -2.45, 4.48, -2.45, 4.48, -2.45, 4.48]\n"
     ]
    }
   ],
   "source": [
    "layer_0 = Input(shape=(6,))\n",
    "layer_1a = Dense(2, activation='linear')(layer_0)\n",
    "layer_1a = RepeatVector(3)(layer_1a)\n",
    "layer_1b = Dense(2, activation='linear')(layer_0)\n",
    "layer_1b = RepeatVector(3)(layer_1b)\n",
    "layer_1c = Dense(2, activation='linear')(layer_0)\n",
    "layer_1c = RepeatVector(3)(layer_1c)\n",
    "layer_1d = Dense(2, activation='linear')(layer_0)\n",
    "layer_1d = RepeatVector(3)(layer_1d)\n",
    "layer_2 = Concatenate(axis=-1)([layer_1a, layer_1b, layer_1c, layer_1d])\n",
    "model = Model(inputs=layer_0, outputs=layer_2)\n",
    "\n",
    "W_1a = np.array([0.1, 0.4, 0.5, 0.1, 1, -2, 0, 0.3, 0.2, 0.1, 3, 0]).reshape((6, 2))\n",
    "b_1a = np.array([0.5, 0.7])\n",
    "W_1b = np.array([1, 0, -0.9, 0.6, -0.7, 0, 0.2, 0.4, 0, 0, -1, 2.3]).reshape((6, 2))\n",
    "b_1b = np.array([0.1, -0.2])\n",
    "W_1c = np.array([1, 0, -0.9, 0.6, -0.7, 0, 0.2, 0.4, 0, 0, -1, 2.3]).reshape((6, 2))\n",
    "b_1c = np.array([0.1, -0.2])\n",
    "W_1d = np.array([1, 0, -0.9, 0.6, -0.7, 0, 0.2, 0.4, 0, 0, -1, 2.3]).reshape((6, 2))\n",
    "b_1d = np.array([0.1, -0.2])\n",
    "model.set_weights([W_1a, b_1a, W_1b, b_1b, W_1c, b_1c, W_1d, b_1d])\n",
    "\n",
    "data_in = [0, 0.2, 0.5, -0.1, 1, 2]\n",
    "data_in_shape = (6,)\n",
    "print('in:', data_in)\n",
    "print('in shape:', data_in_shape)\n",
    "arr_in = np.array(data_in, dtype='float32').reshape(data_in_shape)\n",
    "result = model.predict(np.array([arr_in]))\n",
    "arr_out = result[0]\n",
    "data_out_shape = arr_out.shape\n",
    "print('out shape:', data_out_shape)\n",
    "data_out = format_decimal(arr_out.ravel().tolist())\n",
    "print('out:', data_out)\n",
    "\n",
    "DATA['merge.Concatenate.6'] = {\n",
    "    'input': {'data': data_in, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in [W_1a, b_1a, W_1b, b_1b, W_1c, b_1c, W_1d, b_1d]],\n",
    "    'expected': {'data': data_out, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### export for Keras.js tests"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "\n",
    "filename = '../../../test/data/layers/merge/Concatenate.json'\n",
    "if not os.path.exists(os.path.dirname(filename)):\n",
    "    os.makedirs(os.path.dirname(filename))\n",
    "with open(filename, 'w') as f:\n",
    "    json.dump(DATA, f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\"merge.Concatenate.0\": {\"input\": {\"data\": [0, 0.2, 0.5, -0.1, 1, 2], \"shape\": [6]}, \"weights\": [{\"data\": [0.1, 0.4, 0.5, 0.1, 1.0, -2.0, 0.0, 0.3, 0.2, 0.1, 3.0, 0.0], \"shape\": [6, 2]}, {\"data\": [0.5, 0.7], \"shape\": [2]}, {\"data\": [1.0, 0.0, -0.9, 0.6, -0.7, 0.0, 0.2, 0.4, 0.0, 0.0, -1.0, 2.3], \"shape\": [6, 2]}, {\"data\": [0.1, -0.2], \"shape\": [2]}], \"expected\": {\"data\": [7.3, -0.21, -2.45, 4.48], \"shape\": [4]}}, \"merge.Concatenate.1\": {\"input\": {\"data\": [0, 0.2, 0.5, -0.1, 1, 2], \"shape\": [6]}, \"weights\": [{\"data\": [0.1, 0.4, 0.5, 0.1, 1.0, -2.0, 0.0, 0.3, 0.2, 0.1, 3.0, 0.0], \"shape\": [6, 2]}, {\"data\": [0.5, 0.7], \"shape\": [2]}, {\"data\": [1.0, 0.0, -0.9, 0.6, -0.7, 0.0, 0.2, 0.4, 0.0, 0.0, -1.0, 2.3], \"shape\": [6, 2]}, {\"data\": [0.1, -0.2], \"shape\": [2]}], \"expected\": {\"data\": [7.3, -0.21, -2.45, 4.48, 7.3, -0.21, -2.45, 4.48, 7.3, -0.21, -2.45, 4.48], \"shape\": [3, 4]}}, \"merge.Concatenate.2\": {\"input\": {\"data\": [0, 0.2, 0.5, -0.1, 1, 2], \"shape\": [6]}, \"weights\": [{\"data\": [0.1, 0.4, 0.5, 0.1, 1.0, -2.0, 0.0, 0.3, 0.2, 0.1, 3.0, 0.0], \"shape\": [6, 2]}, {\"data\": [0.5, 0.7], \"shape\": [2]}, {\"data\": [1.0, 0.0, -0.9, 0.6, -0.7, 0.0, 0.2, 0.4, 0.0, 0.0, -1.0, 2.3], \"shape\": [6, 2]}, {\"data\": [0.1, -0.2], \"shape\": [2]}], \"expected\": {\"data\": [7.3, -0.21, 7.3, -0.21, 7.3, -0.21, -2.45, 4.48, -2.45, 4.48, -2.45, 4.48], \"shape\": [6, 2]}}, \"merge.Concatenate.3\": {\"input\": {\"data\": [0, 0.2, 0.5, -0.1, 1, 2], \"shape\": [6]}, \"weights\": [{\"data\": [0.1, 0.4, 0.5, 0.1, 1.0, -2.0, 0.0, 0.3, 0.2, 0.1, 3.0, 0.0], \"shape\": [6, 2]}, {\"data\": [0.5, 0.7], \"shape\": [2]}, {\"data\": [1.0, 0.0, -0.9, 0.6, -0.7, 0.0, 0.2, 0.4, 0.0, 0.0, -1.0, 2.3], \"shape\": [6, 2]}, {\"data\": [0.1, -0.2], \"shape\": [2]}], \"expected\": {\"data\": [7.3, -0.21, 7.3, -0.21, 7.3, -0.21, -2.45, 4.48, -2.45, 4.48, -2.45, 4.48], \"shape\": [6, 2]}}, \"merge.Concatenate.4\": {\"input\": {\"data\": [0, 0.2, 0.5, -0.1, 1, 2], \"shape\": [6]}, \"weights\": [{\"data\": [0.1, 0.4, 0.5, 0.1, 1.0, -2.0, 0.0, 0.3, 0.2, 0.1, 3.0, 0.0], \"shape\": [6, 2]}, {\"data\": [0.5, 0.7], \"shape\": [2]}, {\"data\": [1.0, 0.0, -0.9, 0.6, -0.7, 0.0, 0.2, 0.4, 0.0, 0.0, -1.0, 2.3], \"shape\": [6, 2]}, {\"data\": [0.1, -0.2], \"shape\": [2]}], \"expected\": {\"data\": [7.3, -0.21, -2.45, 4.48, 7.3, -0.21, -2.45, 4.48, 7.3, -0.21, -2.45, 4.48], \"shape\": [3, 4]}}, \"merge.Concatenate.5\": {\"input\": {\"data\": [0, 0.2, 0.5, -0.1, 1, 2], \"shape\": [6]}, \"weights\": [{\"data\": [0.1, 0.4, 0.5, 0.1, 1.0, -2.0, 0.0, 0.3, 0.2, 0.1, 3.0, 0.0], \"shape\": [6, 2]}, {\"data\": [0.5, 0.7], \"shape\": [2]}, {\"data\": [1.0, 0.0, -0.9, 0.6, -0.7, 0.0, 0.2, 0.4, 0.0, 0.0, -1.0, 2.3], \"shape\": [6, 2]}, {\"data\": [0.1, -0.2], \"shape\": [2]}, {\"data\": [1.0, 0.0, -0.9, 0.6, -0.7, 0.0, 0.2, 0.4, 0.0, 0.0, -1.0, 2.3], \"shape\": [6, 2]}, {\"data\": [0.1, -0.2], \"shape\": [2]}], \"expected\": {\"data\": [7.3, -0.21, -2.45, 4.48, -2.45, 4.48, 7.3, -0.21, -2.45, 4.48, -2.45, 4.48, 7.3, -0.21, -2.45, 4.48, -2.45, 4.48], \"shape\": [3, 6]}}, \"merge.Concatenate.6\": {\"input\": {\"data\": [0, 0.2, 0.5, -0.1, 1, 2], \"shape\": [6]}, \"weights\": [{\"data\": [0.1, 0.4, 0.5, 0.1, 1.0, -2.0, 0.0, 0.3, 0.2, 0.1, 3.0, 0.0], \"shape\": [6, 2]}, {\"data\": [0.5, 0.7], \"shape\": [2]}, {\"data\": [1.0, 0.0, -0.9, 0.6, -0.7, 0.0, 0.2, 0.4, 0.0, 0.0, -1.0, 2.3], \"shape\": [6, 2]}, {\"data\": [0.1, -0.2], \"shape\": [2]}, {\"data\": [1.0, 0.0, -0.9, 0.6, -0.7, 0.0, 0.2, 0.4, 0.0, 0.0, -1.0, 2.3], \"shape\": [6, 2]}, {\"data\": [0.1, -0.2], \"shape\": [2]}, {\"data\": [1.0, 0.0, -0.9, 0.6, -0.7, 0.0, 0.2, 0.4, 0.0, 0.0, -1.0, 2.3], \"shape\": [6, 2]}, {\"data\": [0.1, -0.2], \"shape\": [2]}], \"expected\": {\"data\": [7.3, -0.21, -2.45, 4.48, -2.45, 4.48, -2.45, 4.48, 7.3, -0.21, -2.45, 4.48, -2.45, 4.48, -2.45, 4.48, 7.3, -0.21, -2.45, 4.48, -2.45, 4.48, -2.45, 4.48], \"shape\": [3, 8]}}}\n"
     ]
    }
   ],
   "source": [
    "print(json.dumps(DATA))"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
